; Music of Mikie (1986) (Imagine)
; Ripped by Megachur the 05/02/2009

; Need System Vectors !

	write "MIKIE.BIN"

music_date_rip	equ &0529
music_adr	equ &4000
first_theme	equ 0
last_theme	equ 0	; 0 -> 0

	read "music_header_v1_0.asm"

.l4000
	db #01,#00,#00,#00,#01,#02,#08,#08
	db #01,#00,#14,#00,#0e,#00,#0b,#0a
	db #0c,#0f,#12,#46,#00,#01,#00,#0b
	db #02,#0c,#08,#12,#0e,#00,#01,#00
	db #12,#2a,#00,#01,#00,#12,#38,#00
	db #01,#00,#09,#18,#00,#ff
.l402e
	db #01,#00,#00,#00,#01,#01,#07,#07
	db #96,#00,#00,#00,#07,#00,#02,#06
	db #08,#03,#00,#0f,#01,#05,#00,#01
	db #03,#fc,#03,#06,#07,#04,#00,#0f
	db #01,#05,#00,#01,#03,#fc,#0f,#0c
	db #01,#0a,#0b,#11,#12,#0e,#00,#9f
	db #00,#0b,#01,#0e,#96,#00,#0e,#9f
	db #00,#12,#38,#00,#86,#00,#12,#2a
	db #00,#86,#00,#12,#54,#00,#86,#00
	db #12,#0e,#00,#96,#00,#0e,#86,#00
	db #0e,#96,#00,#0e,#86,#00,#12,#38
	db #00,#71,#00,#12,#0e,#00,#96,#00
	db #12,#0e,#00,#86,#00,#0e,#96,#00
	db #12,#07,#00,#86,#00,#0e,#96,#00
	db #12,#38,#00,#9f,#00,#12,#0e,#00
	db #9f,#00,#0e,#96,#00,#0e,#9f,#00
	db #12,#38,#00,#86,#00,#12,#2a,#00
	db #86,#00,#12,#54,#00,#86,#00,#12
	db #0e,#00,#96,#00,#0e,#86,#00,#0e
	db #96,#00,#0e,#86,#00,#12,#38,#00
	db #71,#00,#12,#0e,#00,#96,#00,#12
	db #0e,#00,#86,#00,#0e,#96,#00,#12
	db #07,#00,#86,#00,#0e,#96,#00,#12
	db #38,#00,#9f,#00,#12,#0e,#00,#96
	db #00,#0e,#86,#00,#0e,#7f,#00,#0e
	db #77,#00,#0e,#86,#00,#0e,#8e,#00
	db #12,#1c,#00,#96,#00,#12,#0e,#00
	db #86,#00,#0e,#77,#00,#0e,#71,#00
	db #0e,#6a,#00,#0e,#77,#00,#0e,#7f
	db #00,#12,#1c,#00,#86,#00,#12,#0e
	db #00,#9f,#00,#0e,#96,#00,#0e,#9f
	db #00,#0e,#86,#00,#12,#2a,#00,#c9
	db #00,#12,#0e,#00,#a9,#00,#12,#1c
	db #00,#96,#00,#12,#7e,#00,#a9,#00
	db #12,#2a,#00,#c9,#00,#12,#0e,#00
	db #c9,#00,#0e,#a9,#00,#0e,#96,#00
	db #0e,#a9,#00,#12,#7e,#00,#86,#00
	db #12,#07,#00,#96,#00,#0e,#86,#00
	db #0e,#71,#00,#0e,#96,#00,#0e,#86
	db #00,#0e,#71,#00,#0e,#96,#00,#0e
	db #86,#00,#0e,#71,#00,#0e,#96,#00
	db #0e,#86,#00,#0e,#71,#00,#0e,#96
	db #00,#0e,#a9,#00,#12,#0e,#00,#c9
	db #00,#12,#70,#00,#c9,#00,#12,#2a
	db #00,#c9,#00,#12,#0e,#00,#c9,#00
	db #12,#0e,#00,#a9,#00,#0e,#96,#00
	db #0e,#a9,#00,#12,#7e,#00,#86,#00
	db #12,#07,#00,#96,#00,#0e,#86,#00
	db #0e,#71,#00,#0e,#96,#00,#0e,#86
	db #00,#0e,#71,#00,#0e,#96,#00,#0e
	db #86,#00,#0e,#71,#00,#0e,#96,#00
	db #0e,#86,#00,#0e,#71,#00,#0e,#96
	db #00,#0e,#a9,#00,#12,#0e,#00,#c9
	db #00,#12,#46,#00,#c9,#00,#12,#0e
	db #00,#9f,#00,#09,#2e,#00,#ff,#00
	db #89,#00,#00,#01,#01,#01,#04,#04
	db #77,#00,#00,#00,#06,#00,#02,#06
	db #04,#03,#00,#0f,#01,#05,#00,#01
	db #05,#fd,#01,#12,#0c,#00,#77,#00
	db #0e,#9f,#00,#0e,#77,#00,#12,#18
	db #00,#5f,#00,#12,#0c,#00,#77,#00
	db #0e,#9f,#00,#0e,#be,#00,#0e,#9f
	db #00,#12,#18,#00,#77,#00,#12,#0c
	db #00,#9f,#00,#0e,#77,#00,#0e,#96
	db #00,#0e,#77,#00,#12,#18,#00,#64
	db #00,#12,#0c,#00,#77,#00,#0e,#50
	db #00,#0e,#54,#00,#0e,#59,#00,#0e
	db #5f,#00,#0e,#64,#00,#0e,#6a,#00
	db #12,#06,#00,#77,#00,#0e,#71,#00
	db #0e,#77,#00,#0e,#71,#00,#0e,#77
	db #00,#0e,#71,#00,#0e,#77,#00,#0e
	db #71,#00,#0e,#77,#00,#0e,#71,#00
	db #0e,#77,#00,#13,#09,#88,#00,#ff
.l4276
	push de
	pop iy
	ld a,(iy+#02)
	cp (iy+#03)
	jr z,l4285
	inc (iy+#02)
	ret
.l4285
	xor a
	ld (iy+#02),a
	ld l,(iy+#00)
	ld h,(iy+#01)
.l428f
	add hl,de
	inc hl
	inc hl
	inc hl
.l4293
	ld a,(hl)
	cp #14
.l4296
	jp nc,l4296
	push hl
	add a
	ld hl,l42b2
	ld d,#00
	ld e,a
	add hl,de
	call l43d0
	pop hl
	inc hl
	push iy
	call l42b0
	pop iy
	jr l4293
.l42b0
	push de
	ret
.l42b2
	dw l42da,l42e4,l42fe,l4304
	dw l430c,l4312,l4318,l433c
	dw l4342,l434a,l4350,l4369
	dw l4370,l4377,l437e,l4395
	dw l439c,l43a3,l43af,l42ec
.l42da
	push hl
	call #bcaa
.l42de
	ld de,#0009
.l42e1
	pop hl
	add hl,de
	ret
.l42e4
	push hl
	call #bcaa
	jr c,l42de
	pop hl
	dec hl
.l42ec
	pop de
	pop de
	push de
	pop iy
	or a
	sbc hl,de
	dec hl
	dec hl
	dec hl
	ld (iy+#00),l
	ld (iy+#01),h
	ret
.l42fe
	push hl
	call #bca7
	pop hl
	ret
.l4304
	push hl
	ld a,(hl)
	call #bcb3
	pop hl
	inc hl
	ret
.l430c
	push hl
	call #bcb6
	pop hl
	ret
.l4312
	push hl
	call #bcb6
	pop hl
	ret
.l4318
	ld ix,#bcbc
.l431c
	ld c,(hl)
	inc hl
	push hl
	ld a,(hl)
	and #7f
	ld e,a
	add a
	add e
	inc a
	ld e,a
	ld d,#00
	push de
	ld a,c
	ld de,l43d7
	ld bc,#0010
	ldir
	ld hl,l43d7
	call l43d5
	pop de
	jr l42e1
.l433c
	ld ix,#bcbf
	jr l431c
.l4342
	ld hl,#0001
.l4345
	pop de
	pop de
	jp l428f
.l434a
	call l43d0
	ex de,hl
	jr l4345
.l4350
	call l43d0
	ld (iy+#02),e
	ld (iy+#03),d
	ret
.l435a
	ld bc,#0005
	ld a,(iy+#04)
	cp #02
	jp nc,l4296
	ld d,a
	ld a,(hl)
	inc hl
	ret
.l4369
	call l435a
	ld (iy+#05),a
	ret
.l4370
	call l435a
	ld (iy+#06),a
	ret
.l4377
	call l435a
	ld (iy+#07),a
	ret
.l437e
	call l435a
	ld e,#01
.l4383
	ld (iy+#08),a
	ld a,(hl)
	inc hl
	ld (iy+#09),a
	push hl
	push iy
	pop hl
	add hl,bc
	call l43b8
	pop hl
	ret
.l4395
	call l435a
	ld (iy+#0a),a
	ret
.l439c
	call l435a
	ld (iy+#0b),a
	ret
.l43a3
	call l435a
	ld (iy+#0c),a
	ld a,(hl)
	inc hl
	ld (iy+#0d),a
	ret
.l43af
	call l43a3
	ld e,#00
	ld a,(hl)
	inc hl
	jr l4383
.l43b8
	dec d
	jp nz,#bcaa
	push de
	call #bcaa
	pop de
	ret c
	pop hl
	pop hl
	dec hl
	dec hl
	dec hl
	dec e
	jp z,l42ec
	dec hl
	dec hl
	jp l42ec
.l43d0
	ld e,(hl)
	inc hl
	ld d,(hl)
	inc hl
	ret
.l43d5
	jp (ix)
.l43d7
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00
;
.play_music
;
	ld de,l402e
	call l4276
	ld de,l4000
	jp l4276
;
.init_music	; added by Megachur
;
	ld a,#01
	ld (l402e),a
	ld (l4000),a
	dec a
	ld (l4000+#01),a
	ld (l4000+#03),a
	ld (l4000+#2f),a
	ld (l4000+#31),a
	ld (l4000+#02),a
	ld (l4000+#30),a

	ld hl,evt_bloc
	ld bc,#8100
	ld de,play_music
	jp #bcd7	; call play_music every CRT interrupt
evt_bloc
	db #00,#00,#00,#00,#00,#00
	db #00,#00,#00
;	
;
.game_name
	db "Mikie",0
.game_year
	db "1986",0
.game_publisher
	db "Imagine",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
